home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / math / maca_101.zip / ARRAYS.DEM < prev    next >
Text File  |  1996-01-30  |  2KB  |  102 lines

  1. ;ARRAYS.DEM
  2. ;DEMO FILE FOR MASSCALC VERSION 1.00
  3. ;WRITTEN BY: Ralph W. Reid
  4. ;This file may only be distributed in its unmodified form.
  5. ;
  6. ;DESCRIPTION:  This file primarily demonstrates array creation and usage.
  7. ;
  8. ;For the latest releases of MASSCALC and other software created by
  9. ;Ralph W. Reid, see http://www2.athenon.com/~rreid/products/00-index.html.
  10. ;
  11. ;HOW TO USE THIS FILE:  This file may be piped into MASSCALC, and its
  12. ;output displayed as follows:
  13. ;TYPE ARRAYS.DEM | MASSCALC | MORE
  14. ;This file may be redirected into MASSCALC and its output displayed
  15. ;as follows:
  16. ;MASSCALC < ARRAYS.DEM | MORE
  17. ;These two commands should be run from the operating system prompt.
  18.  
  19. ;Create and display an array with four rows.
  20. create array: A (4);
  21. print: "Array A created and initialized to:"
  22. A;
  23.  
  24. ;Create and display an array with four columns.
  25. create array: B (1, 4);
  26. print:
  27. print: "Array B created and initialized to:"
  28. B;
  29.  
  30. ;Assign values to both arrays and display the results.
  31. A = 1, 2, 3, 4;
  32. B = A;
  33. print:
  34. print: "Array A assigned values:"
  35. A;
  36. print:
  37. print: "Array B assigned values:"
  38. B;
  39.  
  40. ;Multiply the two arrays together.
  41. print:
  42. print: "A * B:"
  43. A * B;
  44.  
  45. ;Create an array to hold the result.
  46. create array: C (4, 4);
  47. print:
  48. print: "Array C initialized to:"
  49. C;
  50.  
  51. ;Assign C: A*B.
  52. C = A * B;
  53. print:
  54. print: "Array C assigned:"
  55. C;
  56.  
  57. ;Display C + C.
  58. print:
  59. print: "C + C:"
  60. C + C;
  61.  
  62. ;Display some simple multiplications of C.
  63. print:
  64. print: "2 * C:"
  65. 2 * C;
  66. print:
  67. print: "3 * C:"
  68. 3 * C;
  69.  
  70. ;Clean up some memory.
  71. print: "User defined variables in memory:"
  72. Show variables.
  73. Delete all arrays.
  74. print:
  75. print: "All user defined variables have been removed."
  76.  
  77. ;Create a six row and a six column array.
  78. create array: sixrows [6];
  79. create array: sixcols [1, 6];
  80. sixrows = log_b (2, 2), log (100), floor (_pi), ceil (_pi),
  81.   2^2+1, floor (sin (_pi/2)) + 5;
  82.   sixcols = 6 * sixrows;
  83. print:
  84. print: "sixrows and sixcols arrays:"
  85. sixrows;
  86. sixcols;
  87.  
  88. ;Create and display a 3 dimensional array.
  89. create array: big array [log (100), _pi - 1, _pi];
  90. print:
  91. print: "big array info:"
  92. Show array structure: big array;
  93. print:
  94. print: "big array initial values:"
  95. big array;
  96.  
  97. ;Assign some values to big array and display the result.
  98. big array = sixrows, sixcols;
  99. print: "big array assigned: sixrows, sixcols:"
  100. big array;
  101.  
  102.